package de.dhbw.horb.inf2013.vierFarbenProblem.view.java2D;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.LinkedList;
import java.util.List;

import javax.swing.JPanel;

/**
 * The Class SquareContainer.
 */
public class SquareContainer extends JPanel {

	/** The squares. */
	protected List<Square> squares = new LinkedList<Square>();

	/**
	 * Adds the square.
	 * 
	 * @param square
	 *            the square
	 */
	public void addSquare(Square square) {
		squares.add(square);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
	 */
	@Override
	public void paintComponent(Graphics g) {
		Graphics2D g2d = (Graphics2D) g;
		for (Square square : squares) {
			square.paint(g2d);
		}
	}

}
